REM Hw4 Test: Multiple Attackers, Closest battery shoots.

REM  === General ===
SET TestNumber=4
SET ExeFile=..\Debug\hw4-iron-dome.exe
SET BaseAddr=127.0.%TestNumber%
SET BasePort=5000
SET CmdLineFile=Test%TestNumber%_simple.bat
SET /A NodeId=0

REM  === Clock ===
SET /A NodeId=NodeId+1
SET ClkAddr=%BaseAddr%.%NodeId% %BasePort%%NodeId%

REM  === Real World Simulator ===
SET /A NodeId=NodeId+1
SET RwsAddr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET MinX=10
SET MaxX=11
SET MinY=10
SET MaxY=11
SET MinT=7
SET MaxT=13
SET MinTheta=80
SET MaxTheta=90
SET MinV=4
SET MaxV=6
SET P=0.5
SET STD_V=0.1
SET STD_X=0.2
SET N=3
SET RwsSeed=1112
SET RwsParams=%RwsAddr% %ClkAddr% %MinX% %MaxX% %MinY% %MaxY% %MinT% %MaxT% %MinTheta% %MaxTheta% %MinV% %MaxV% %P% %STD_V% %STD_X% %N% %RwsSeed%

REM  === Iron Dome Manager ===
SET /A NodeId=NodeId+1
SET IdmAddr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Z=1000
SET IdmX=20
SET IdmY=80
SET IdmSeed=1001
SET IdmParams=%IdmAddr% %ClkAddr% %RwsAddr% %Z% %IdmX% %IdmY% %IdmSeed%

REM  === Battery A and Interceptors ===
SET /A NodeId=NodeId+1
SET Bt_A_Addr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Bt_A_X=30
SET Bt_A_Y=20
SET Bt_A_Int_V=7
SET Bt_A_Int_M=7
SET Bt_A_Int_Pintercept=0.5
SET Bt_A_Params=%Bt_A_Addr% %ClkAddr% %IdmAddr% %Bt_A_X% %Bt_A_Y%

SET /A NodeId=NodeId+1
SET Bt_A_Int1_Addr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Bt_A_Int1_Params=%Bt_A_Int1_Addr%  %ClkAddr% %Bt_A_Addr% %RwsAddr% %Bt_A_Int_V% %Bt_A_Int_M% %Bt_A_Int_Pintercept%

REM  === Battery B and Interceptors ===
SET /A NodeId=NodeId+1
SET Bt_B_Addr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Bt_B_X=40
SET Bt_B_Y=25
SET Bt_B_Int_V=8
SET Bt_B_Int_M=8
SET Bt_B_Int_Pintercept=0.5
SET Bt_B_Params=%Bt_B_Addr% %ClkAddr% %IdmAddr% %Bt_B_X% %Bt_B_Y%

SET /A NodeId=NodeId+1
SET Bt_B_Int1_Addr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Bt_B_Int1_Params=%Bt_B_Int1_Addr%  %ClkAddr% %Bt_B_Addr% %RwsAddr% %Bt_B_Int_V% %Bt_B_Int_M% %Bt_B_Int_Pintercept%

REM  === Battery C and Interceptors ===
SET /A NodeId=NodeId+1
SET Bt_C_Addr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Bt_C_X=50
SET Bt_C_Y=30
SET Bt_C_Int_V=10
SET Bt_C_Int_M=10
SET Bt_C_Int_Pintercept=0.5
SET Bt_C_Params=%Bt_C_Addr% %ClkAddr% %IdmAddr% %Bt_C_X% %Bt_C_Y%

SET /A NodeId=NodeId+1
SET Bt_C_Int1_Addr=%BaseAddr%.%NodeId% %BasePort%%NodeId%
SET Bt_C_Int1_Params=%Bt_C_Int1_Addr%  %ClkAddr% %Bt_C_Addr% %RwsAddr% %Bt_C_Int_V% %Bt_C_Int_M% %Bt_C_Int_Pintercept%

REM  === Command Lines ===

del %CmdLineFile%
SET /A NumOfOtherNodes = NodeId-1
echo start %ExeFile% RealWorldSimulator %RwsParams% >> %CmdLineFile%
echo start %ExeFile% IronDomeManager %IdmParams% >> %CmdLineFile%
echo start %ExeFile% Battery %Bt_A_Params% >> %CmdLineFile%
echo start %ExeFile% Interceptor %Bt_A_Int1_Params% >> %CmdLineFile%
echo start %ExeFile% Battery %Bt_B_Params% >> %CmdLineFile%
echo start %ExeFile% Interceptor %Bt_B_Int1_Params% >> %CmdLineFile%
echo start %ExeFile% Battery %Bt_C_Params% >> %CmdLineFile%
echo start %ExeFile% Interceptor %Bt_C_Int1_Params% >> %CmdLineFile%
echo start %ExeFile% Clock %ClkAddr% %NumOfOtherNodes% >> %CmdLineFile%

echo Created file %CmdLineFile% which contains the command lines. Running it:
%CmdLineFile%